package com.qiangesoft.bootcodegen.constant;

import com.qiangesoft.bootcodegen.utils.KvVO;

import java.util.ArrayList;
import java.util.List;

/**
 * 页面组件类型枚举
 *
 * @author qiangesoft
 * @date 2024-03-15
 */
public enum HtmlType {

    INPUT("input", "输入框"),

    INPUT_NUMBER("inputnumber", "数字输入框"),

    TEXTAREA("textarea", "文本域"),

    SELECT("select", "下拉框"),

    CHECKBOX("checkbox", "复选框"),

    RADIO("radio", "单选框"),

    DATE("date", "日期"),

    DATEtIME("datetime", "时间"),

    SWITCH("switch", "开关"),
    ;

    private final String key;

    private final String value;

    HtmlType(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    /**
     * 获取值
     *
     * @return
     */
    public static List<KvVO> getValues() {
        List<KvVO> voList = new ArrayList<>();
        for (HtmlType value : values()) {
            KvVO kv = new KvVO();
            kv.setKey(value.getKey());
            kv.setValue(value.getValue());
            voList.add(kv);
        }
        return voList;
    }
}